// 作用是对按钮进行鉴权处理,不同用户有不同的按钮权限
import store from "@/store";
function hasBtnPermission(App) {
  // 获取用户数据

  App.directive("has", {
    inserted: (node, bindings) => {
      let res = store.state.user.userInfo.buttons;
      if (!res.includes(bindings.value)) {
        //如果不包含,就不显示
        node.parentNode.removeChild(node);
      }
    },
  });

  //   App.directive("has", {
  //     mounted(node, bindings) {
  //       let res = store.state.user.userInfo.buttons;
  //       if (res.includes(bindings.value)) {
  //         //如果不包含,就不显示
  //         node.parentNode.removeChild(node);
  //         console.log(node);
  //       }
  //     },
  //   });
}

export default hasBtnPermission;
